#ifndef _XTABLE_H_
#define _XTABLE_H_

#incluce <stdlib.h>

#ifndef _XD_NODE_
#define _XD_NODE_

typedef struct XD_NODE
{
	unsigned int id;
	struct XD_NODE *nxt, *bak, **uplnk;
	union
	{
		double coord[4] __attribute__((aligned(64)));
		struct XD_NODE **dnlnk;
	};
}Xnode;

#endif /*_XNODE_*/

#ifndef _XD_TABLE_
#define _XD_TABLE_

typedef struct XD_TABLE __attribute__((aligned(64)))
{
	Xnode *table[5] __attribute__((aligned(64)));
	unsigned int dim[2]; /* 0 for coord, 1 for struct */
} *Xtable;

extern int Xtable_init(Xtable this);

extern int Xtable_clear(Xtable this);

extern int Xtable_add_point(Xtable this, const double *coord);

extern int Xtable_add_struct(Xtable this, const unsigned int dim, const unsigned int *dnlnk_id);

extern int Xtable_delete(Xtable this, const unsigned int dim, const unsigned int target_id)
#endif /*_XD_TABLE_*/

#endif /*_XTABLE_H_*/
